@extends('backend::common.common_right')
@section('content')
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class=" row m-b-sm m-t-sm">
                            <div class="col-md-6">
                            <form method="get" action="{{url('backend/downlist',['type'=>$type])}}">
                                <div class="layui-input-inline">
                                    <label>日期范围</label>
                                    <input type="text" name="date" autocomplete="off" value="{{$date or ''}}" class="layui-input" id="renderdate" placeholder=" - " lay-key="7">
                                </div>
                                <span class="checkbox col-md-2 m-r-xs" style="margin: 0px;padding: 0px">
                                    <select class="form-control catsshow" id="seach">
                                        <option value="name">下载用户</option>
                                        <option value="earningname">收益用户</option>
                                        <option value="data_id">模型ID</option>
                                    </select>
                               </span>
                                <div class="input-group">
                                    <input type="text" id="seachname" placeholder="请输入用户名" name="name"
                                           class="form-control">
                                    <span class="input-group-btn">
                                     <button type="submit" class="btn  btn-primary"> 搜索</button>
                                     </span>
                                </div>
                                <div  class="btn-group">
                                    <a class="btn btn-primary" href="{{url('backend/downlist',['type'=>$type])}}" aria-pressed="false">全部</a>
                                </div>
                            </form>
                            </div>

                        </div>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered table-hover " id="editable">
                            <thead>
                            <tr>
                                <th>下载编号</th>
                                <th>下载用户</th>
                                <th>素材名称</th>
                                <th>素材价格</th>
                                <th>收益用户</th>
                                <th>收益金额</th>
                                <th>下载时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($downs as $do)
                                <tr class="gradeX">
                                    <td>{{$do->id}}</td>
                                    <td><a href="{{url('backend/userinfo',['id'=>$do->user_id])}}"
                                           class="text-navy">{{$do->user->name}}</a></td>
                                    <td><a href="{{url($redirecturl)}}?modeId={{$do->data_id}}" target="__blank">{{$do->data->title or ''}}<span style="float: right">{{$do->data_id}}</span></a></td>
                                    <td class="center">{{$do->coins}}</td>
                                    <td class="center">
                                        <a href="{{url('backend/userinfo',['id'=>$do->earning_user_id])}}"
                                           class="text-navy">{{$do->earning->name or ''}}</a></td>
                                    <td>{{$do->money}}</td>
                                    <td>{{$do->created_at}}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                        {{$downs->links()}}
                    </div>
                </div>
            </div>
        </div>
<script>
    $('#seach').change(function () {
        var seachname = $(this).children('option:selected').val()
        $("#seachname").attr('name', seachname);
    })
</script>
@endsection


